import React, { useId } from 'react'

function PasswordField(){
    const passworldHintId = useId();
    console.log('passworldHintId',passworldHintId);
    
    return (
        <>
            <label>
                密码:
                <input type="password" aria-describedby={passworldHintId} />
            </label>
            <p id={passworldHintId}>
                密码应该包含至少 18 个字符
            </p>
        </>
    )
}

function App(){
    const id = useId()
    console.log('id',id) // 位置越高 id越小
    return (
        <div>
            <h2>输入密码</h2>
            <PasswordField />
            <h2>确认密码</h2>
            <PasswordField />
        </div>
    )
}


export default App